package dfbz.staticDemo;

public class Student {
    private String name;
    private int age;
    static int id=1;
    private int stuId;
   static {
       /*
        * 类中方法外
        * 随着类加载，而且执行唯一的一次
        * */
       System.out.println("数据库加载完毕.......");
       System.out.println("引擎加载完毕.......");
       System.out.println("3D加载完毕.......");
   }

    public Student() {
       this.stuId=id++;
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
        this.stuId=id++;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getStuId() {
        return stuId;
    }

    public void setStuId(int stuId) {
        this.stuId = stuId;
    }
    public void show(){
        System.out.println("Student : name="+this.name+", age="+this.age+", stuId="+this.stuId);
    }
}
